package vn.gq.udv.bean;

import org.json.JSONException;
import org.json.JSONObject;


public class AppInfo {
	
	public int versionCode = 1;
	public int databaseVersion = 1;
	public String url;
	public String msg;

	public AppInfo() {
		
	}
	
	public AppInfo(String jsonStr) {
		try {
			JSONObject input = new JSONObject(jsonStr);
			versionCode = input.getInt("versionCode");
			databaseVersion = input.getInt("databaseVersion");
			url = input.getString("url");
			msg = input.getString("msg");
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}
	
	public JSONObject toJson() {
		JSONObject ob = new JSONObject();
		try {
			ob.put("versionCode", versionCode);
			ob.put("databaseVersion", databaseVersion);
			ob.put("url", url);
			ob.put("msg", msg);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return ob;
	}
}
